package com.wisely.xxboot.domain;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Collection;
import java.util.LinkedHashSet;

/**
 * <p>Description:</p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <p>Company: 中视数讯</p>
 * <p>Site: www.digi-zones.com</p>
 *
 * @author shengping
 * @version 1.0
 * @date 2017/7/3
 */

@Document //1 @Document注解映射领域模型和Mongodb文档
public class MongoPerson {
    @Id //2 @Id注解表明这个属性为文档的ID
    private String id;
    private String name;
    private Integer age;
    @Field("locs") //3 @Field注解此属性文档中的名称为locs，locations 属性将以数组的形式存在当前数据记录中
    private Collection<MongoLocation> locations = new LinkedHashSet<MongoLocation>();

    public Collection<MongoLocation> getLocations() {
        return locations;
    }

    public void setLocations(Collection<MongoLocation> locations) {
        this.locations = locations;
    }

    public MongoPerson(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
